package elements.login;

import com.robotium.solo.Solo;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import utils.Util;
import utils.MyException.NotFoundException;

public class Login_page {

	public Solo solo;
//	com.mainbo.homeschool:id/btn_ok
//	com.mainbo.homeschool:id/btn_left
//	com.mainbo.homeschool:id/tv_message
	private TextView tv_title,btn_left;
	private Button btn_verify,btn_ok;
	private EditText et_phone, et_verify;
	private ImageView define_btn_back;

	public Login_page(Solo solo) {
		this.solo = solo;
	}
	
	// 获取相应对象
	public TextView getTv_title() throws NotFoundException {
		tv_title = (TextView) Util.myGetView(solo, "com.mainbo.homeschool:id/tv_title");
		return tv_title;
	}
	
	
	public TextView getbtn_left() throws NotFoundException {
		btn_left = (TextView) Util.myGetView(solo, "com.mainbo.homeschool:id/btn_left");
		return btn_left;
	}
	public void clickOn_Left() throws NotFoundException{
		solo.clickOnView(getbtn_left());
	}
	
	public Button getBtn_ok() throws NotFoundException {
		btn_ok = (Button) Util.myGetView(solo, "btn_ok");
		return btn_ok;
	}
	
	public Button getBtn_verify() throws NotFoundException {
		btn_verify = (Button) Util.myGetView(solo, "btn_verify");
		return btn_verify;
	}

	public EditText getEt_phone() throws NotFoundException {
		et_phone = (EditText) Util.myGetView(solo, "et_phone");
		return et_phone;
	}

	public EditText getEt_verify() throws NotFoundException {
		et_verify = (EditText) Util.myGetView(solo, "et_verify");
		return et_verify;
	}

	public ImageView getDefine_btn_back() throws NotFoundException {
		define_btn_back = (ImageView) Util.myGetView(solo, "define_btn_back");
		return define_btn_back;
	}
	// 控件相关操作

	public void enter_PhoneNumber(String message) throws NotFoundException {
		solo.enterText(getEt_phone(), message);
	}
	public void clear_PhoneNumber() throws NotFoundException {
		solo.clearEditText(getEt_phone());
	}

	public void enter_verifyCode(String message) throws NotFoundException {
		solo.enterText(getEt_verify(), message);
	}
	public void clear_verifyCode() throws NotFoundException {
		solo.clearEditText(getEt_verify());
	}

	public void clickOn_enter_PhoneNumber() throws NotFoundException {
		solo.clickOnView(getEt_phone());
	}

	public void click_btn_verify() throws NotFoundException {
		solo.clickOnView(getBtn_verify());
	}

	public void clickOn_back() throws NotFoundException {
		solo.clickOnView(getDefine_btn_back());
	}
	public void clickOn_BtOk() throws NotFoundException{
		solo.clickOnView(getBtn_ok());
	}
}
